<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="../../../layui/css/layui.css" media="all">
    <script src="../../../js/jquery/1.x/jquery.js"></script>
    <script src="../../../layui/layui.js" charset="utf-8"></script>
    <script src="../../../js/config.js"></script>
    <script src="../../../js/public.js"></script>
    <script src="../../../js/function.js"></script>
    <link rel="stylesheet" href="../../../css/public.css">
    <link rel="stylesheet" href="../../../css/patient/qss.css">
    <style>
        .qss-item-title button {
            margin-left: 2em;
            float: none;
        }
        
        .qss-form-item button {
            float: right;
            font-size: 14px;
            color: white;
            width: 98px;
            line-height: 24px;
            border: 0;
            border-radius: 3px;
            background: #4777E7;
        }
        
        .qss-form-item .check-date {
            float: left;
        }
        
        .qss-form-item .check-date input {
            display: inline-block;
        }
        
        .layui-table .layui-input {
            border: 1px #d2d2d2 solid !important;
            height: 30px !important;
        }
        
        .qss-item-table .layui-table td {
            padding: 10px;
        }
    </style>
</head>

<body>
    <div class="container">
        <div class="tab-title">
            <ul class="tab-title-tab">
                <li>
                    <a href="../V1_1/patient_info.html">
                        <p>基本信息</p>
                        <p class="complete_basic">0%</p>
                    </a>
                </li>
                <li>
                    <a href="./qss1.html">
                        <p>病历采集</p>
                        <p class="complete_qss">0%</p>
                    </a>
                </li>
                <li class="tab-curr">
                    <a href="./qss7.html">
                        <p>检查信息</p>
                        <p style="display: none;">0%</p>
                    </a>
                </li>
                <div class="clear"></div>
            </ul>
        </div>
        <div class="qss-container">
            <div class="qss-box">
                <form class="layui-form qss-form">
                    <div class="qss-item">
                        <div class="qss-item-title">
                            <p>a.糖耐量试验+胰岛素/C肽释放试验</p><button type="button" class="add-new-200">新增一份检查</button>
                        </div>
                        <div class="content-200" data-qid="200">
                            <div class="qss-form-item layui-form-item table-200">
                                <div class="qss-form-item layui-form-item">
                                    <div class="check-date">检查日期 <input type="text" class="layui-input table-input date-200" autocomplete="off" readonly="readonly" id="date200"></div>
                                    <button type="button" class="del">删除本次</button>
                                    <div class="qss-item-table">
                                        <table class="layui-table" lay-even lay-skin="" style="border:1px solid #cccccc;">
                                            <thead>
                                                <tr>
                                                    <th></th>
                                                    <th>0分钟</th>
                                                    <th>30分钟</th>
                                                    <th>60分钟</th>
                                                    <th>120分钟</th>
                                                    <th>180分钟</th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                                <tr>
                                                    <td>葡萄糖（mmol/L）</td>
                                                    <td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200001" name="200001"></td>
                                                    <td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200002" name="200002"></td>
                                                    <td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200003" name="200003"></td>
                                                    <td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200004" name="200004"></td>
                                                    <td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200005" name="200005"></td>
                                                </tr>
                                                <tr>
                                                    <td>胰岛素（&#181;IU/ml）</td>
                                                    <td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200006" name="200006"></td>
                                                    <td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200007" name="200007"></td>
                                                    <td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200008" name="200008"></td>
                                                    <td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200009" name="200009"></td>
                                                    <td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200010" name="200010"></td>
                                                </tr>
                                                <tr>
                                                    <td>C肽（&#181;g/L）</td>
                                                    <td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200011" name="200011"></td>
                                                    <td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200012" name="200012"></td>
                                                    <td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200013" name="200013"></td>
                                                    <td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200014" name="200014"></td>
                                                    <td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200015" name="200015"></td>
                                                </tr>
                                            </tbody>
                                        </table>
                                    </div>
                                </div>
                                <div class="qss-form-item layui-form-item">
                                    <div class="layui-form-label layui-form-item" style="margin-bottom:5px;">糖化血红蛋白：<input type="text" lay-verify="number_char" lay-verType="tips" class="input-border-bottom data-201" name="201">%</div>
                                </div>
                                <div class="qss-form-item layui-form-item">
                                    <div class="layui-form-label layui-form-item" style="margin-bottom:5px;">糖化血清蛋白：<input type="text" lay-verify="number_char" lay-verType="tips" class="input-border-bottom data-202" name="202">%</div>
                                </div>
                                <div class="qss-form-item layui-form-item">
                                    <div class="layui-form-label layui-form-item" style="margin-bottom:5px;">
                                        抗体指标：GAD-ab<input type="text" class="input-border-bottom data-203001" name="203001">IU/ml， ICA
                                        <input type="text" lay-verify="number_char" lay-verType="tips" class="input-border-bottom data-203002" name="203002">， IAA
                                        <input type="text" lay-verify="number_char" lay-verType="tips" class="input-border-bottom data-203003" name="203003">
                                    </div>
                                </div>
                            </div>
                        </div>

                    </div>

                    <div class="qss-item">
                        <div class="qss-item-title">
                            <p>b.常规生化</p><button type="button" class="add-new-204">新增一份检查</button>
                        </div>
                        <div class="content-204" data-qid="204">
                            <div class="qss-form-item layui-form-item table-204">
                                <div class="qss-form-item layui-form-item">
                                    <div class="check-date">检查日期 <input type="text" class="layui-input table-input date-204" autocomplete="off" readonly="readonly" id="date204"></div>
                                    <button type="button" class="del">删除本次</button>
                                    <div class="qss-item-table">
                                        <table class="layui-table" lay-even lay-skin="" style="border:1px solid #cccccc;">
                                            <thead>
                                                <tr>
                                                    <th>指标</th>
                                                    <th>测定值</th>
                                                    <th>单位</th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                                <tr>
                                                    <td>超敏C反应蛋白</td>
                                                    <td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204001" name="204001"></td>
                                                    <td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">mg/L</td>
                                                </tr>
                                                <tr>
                                                    <td>白细胞计数（WBC）</td>
                                                    <td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204002" name="204002"></td>
                                                    <td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">×10^9/L</td>
                                                </tr>
                                                <tr>
                                                    <td>白蛋白（ALB）</td>
                                                    <td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204003" name="204003"></td>
                                                    <td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">g/L</td>
                                                </tr>
                                                <tr>
                                                    <td>尿素（BUN）</td>
                                                    <td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204004" name="204004"></td>
                                                    <td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">mmol/L</td>
                                                </tr>
                                                <tr>
                                                    <td>肌酐（CR）</td>
                                                    <td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204005" name="204005"></td>
                                                    <td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">μmol/L</td>
                                                </tr>
                                                <tr>
                                                    <td>尿酸（UA）</td>
                                                    <td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204006" name="204006"></td>
                                                    <td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">μmol/L</td>
                                                </tr>
                                                <tr>
                                                    <td>甘油三酯（TG）</td>
                                                    <td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204007" name="204007"></td>
                                                    <td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">mmol/l</td>
                                                </tr>
                                                <tr>
                                                    <td>总胆固醇（TC）</td>
                                                    <td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204008" name="204008"></td>
                                                    <td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">mmol/l</td>
                                                </tr>
                                                <tr>
                                                    <td>高密度脂蛋白胆固醇（HDL-c）</td>
                                                    <td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204009" name="204009"></td>
                                                    <td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">mmol/l</td>
                                                </tr>
                                                <tr>
                                                    <td>低密度脂蛋白胆固醇（LDL-c）</td>
                                                    <td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204010" name="204010"></td>
                                                    <td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">mmol/l</td>
                                                </tr>
                                                <tr>
                                                    <td>钠（Na）</td>
                                                    <td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204011" name="204011"></td>
                                                    <td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">mmol/l</td>
                                                </tr>
                                                <tr>
                                                    <td>钾（K）</td>
                                                    <td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204012" name="204012"></td>
                                                    <td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">mmol/l</td>
                                                </tr>
                                                <tr>
                                                    <td>D-二聚体</td>
                                                    <td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204013" name="204013"></td>
                                                    <td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">ng</td>
                                                </tr>
                                                <tr>
                                                    <td>纤维蛋白质</td>
                                                    <td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204014" name="204014"></td>
                                                    <td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">g/L</td>
                                                </tr>
                                                <tr>
                                                    <td>24小时尿微量白蛋白</td>
                                                    <td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204015" name="204015"></td>
                                                    <td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">mg/24h</td>
                                                </tr>
                                                <tr>
                                                    <td>尿白蛋白/肌酐</td>
                                                    <td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204016" name="204016"></td>
                                                    <td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">mg/mmol</td>
                                                </tr>
                                                <tr>
                                                    <td>24小时尿量</td>
                                                    <td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204017" name="204017"></td>
                                                    <td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">L</td>
                                                </tr>
                                                <tr>
                                                    <td>24小时尿蛋白定量</td>
                                                    <td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204018" name="204018"></td>
                                                    <td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">mg/24h</td>
                                                </tr>
                                            </tbody>
                                        </table>
                                    </div>
                                </div>
                                <div class="qss-form-item layui-form-item">
                                    <div class="layui-form-label layui-form-item" style="margin-bottom:5px;">CG eGFR：<input type="text" lay-verify="number_char" lay-verType="tips" class="input-border-bottom data-204019" name="204019">ml/min（系统自动计算），MDRD eGFR:<input type="text" lay-verify="number_char" lay-verType="tips" class="input-border-bottom data-204020"
                                            name="204020">ml/min（系统自动计算）</div>
                                </div>
                                <div class="qss-form-item layui-form-item">
                                    <div class="layui-form-label layui-form-item" style="margin-bottom:5px;">备注：CG公式：（140-年龄）*体重/（0.81*血肌酐）*（0.85女性）</div>
                                </div>
                                <div class="qss-form-item layui-form-item">
                                    <div class="layui-form-label layui-form-item" style="margin-bottom:5px;">MDRD简化公式：175*（血肌酐/88.4）^-1.234*年龄^-0.179*（0.79女性）</div>
                                </div>
                            </div>
                        </div>

                    </div>

                    <div class="qss-item-btn">
                        <div class="qss-item-btn">
                            <a href="javascript:;">
                                <button type="button" lay-submit="" lay-filter="submit-btn" data-type="1">提交</button>
                            </a>
                            <a href="javascript:;">
                                <button type="button" lay-submit="" lay-filter="submit-btn" data-type="0">保存并留在本页</button>
                            </a>
                            <a href="../list.html">
                                <button type="button">放弃编辑</button>
                            </a>
                        </div>
                    </div>
                </form>
                <div class="fixed-nav">
                    <ul>
                        <li><a href="qss7.html">肿瘤定制化检查</a></li>
                        <li><a href="qss8.html">其他靶向激素检查</a></li>
                        <li><a href="qss9.html">辅助检查</a></li>
                        <li class="fixed-nav-curr"><a>其他实验室检查</a></li>
                    </ul>
                    <button type="button" lay-submit="" lay-filter="submit-btn" data-type="1">提交</button>
                </div>
            </div>
        </div>

    </div>
</body>
<script>
    function initForm(patient_id, form, laydate) {
        //获取答案,初始化表单
        ajax_get(configUrl.qssInfo, {
            user_id: patient_id,
            visit_level: 1,
            template_id: 20
        }, (res) => {
            console.log(res.data.more_answer)
            $.each(res.data.more_answer, function(index, item) {
                if (index == 200) {
                    $('.content-200').empty();
                    $.each(item, function(index2, item2) {
                        var randId = Math.ceil(Math.random() * 10000);
                        var str = '<div class="qss-form-item layui-form-item item-200' + index2 + ' table-200">' +
                            '<div class="qss-form-item layui-form-item">' +
                            '<div class="check-date">检查日期 <input type="text" class="layui-input table-input date-200"  autocomplete="off" readonly="readonly" id="date200-' + randId + '"></div>' +
                            '<button type="button" class="del">删除本次</button>' +
                            '<div class="qss-item-table">' +
                            '<table class="layui-table" lay-even lay-skin="" style="border:1px solid #cccccc;">' +
                            '<thead>' +
                            '<tr>' +
                            '<th></th>' +
                            '<th>0分钟</th>' +
                            '<th>30分钟</th>' +
                            '<th>60分钟</th>' +
                            '<th>120分钟</th>' +
                            '<th>180分钟</th>' +
                            '</tr>' +
                            '</thead>' +
                            '<tbody>' +
                            '<tr>' +
                            '<td>葡萄糖（mmol/L）</td>' +
                            '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200001" name="200001"></td>' +
                            '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200002" name="200002"></td>' +
                            '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200003" name="200003"></td>' +
                            '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200004" name="200004"></td>' +
                            '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200005" name="200005"></td>' +
                            '</tr>' +
                            '<tr>' +
                            '<td>胰岛素（&#181;IU/ml）</td>' +
                            '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200006" name="200006"></td>' +
                            '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200007" name="200007"></td>' +
                            '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200008" name="200008"></td>' +
                            '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200009" name="200009"></td>' +
                            '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200010" name="200010"></td>' +
                            '</tr>' +
                            '<tr>' +
                            '<td>C肽（&#181;g/L）</td>' +
                            '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200011" name="200011"></td>' +
                            '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200012" name="200012"></td>' +
                            '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200013" name="200013"></td>' +
                            '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200014" name="200014"></td>' +
                            '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200015" name="200015"></td>' +
                            '</tr>' +
                            '</tbody>' +
                            '</table>' +
                            '</div>' +
                            '</div>' +
                            '<div class="qss-form-item layui-form-item">' +
                            '<div class="layui-form-label layui-form-item" style="margin-bottom:5px;">糖化血红蛋白：<input type="text" lay-verify="number_char" lay-verType="tips" class="input-border-bottom data-201" name="201">%</div>' +
                            '</div>' +
                            '<div class="qss-form-item layui-form-item">' +
                            '<div class="layui-form-label layui-form-item" style="margin-bottom:5px;">糖化血清蛋白：<input type="text" lay-verify="number_char" lay-verType="tips" class="input-border-bottom data-202" name="202">%</div>' +
                            '</div>' +
                            '<div class="qss-form-item layui-form-item">' +
                            '<div class="layui-form-label layui-form-item" style="margin-bottom:5px;">' +
                            '抗体指标：GAD-ab<input type="text" lay-verify="number_char" lay-verType="tips" class="input-border-bottom data-203001" name="203001">IU/ml，' +
                            'ICA<input type="text" lay-verify="number_char" lay-verType="tips" class="input-border-bottom data-203002" name="203002">，' +
                            'IAA<input type="text" lay-verify="number_char" lay-verType="tips" class="input-border-bottom data-203003" name="203003">' +
                            '</div>' +
                            '</div>' +
                            '</div>';
                        $('.content-200').append(str);
                        laydate.render({
                            elem: '#date200-' + randId
                        })
                        $.each(item2, function(index3, item3) {
                            if (index3 == 0) {
                                if (item3.date != '0000-00-00') {
                                    $('.item-200' + index2).find('.date-200').val(item3.date);
                                }
                            }
                            $('.item-200' + index2).find('.data-' + item3.answer_id).val(item3.answer_name);
                        })
                    });
                }
                if (index == 204) {
                    $('.content-204').empty();
                    $.each(item, function(index2, item2) {
                        var randId = Math.ceil(Math.random() * 10000);
                        var str = '<div class="qss-form-item layui-form-item item-204' + index2 + ' table-204">' +
                            '<div class="qss-form-item layui-form-item">' +
                            '<div class="check-date">检查日期 <input type="text" class="layui-input table-input date-204"  autocomplete="off" readonly="readonly" id="date204-' + randId + '"></div>' +
                            '<button type="button" class="del">删除本次</button>' +
                            '<div class="qss-item-table">' +
                            '<table class="layui-table" lay-even lay-skin="" style="border:1px solid #cccccc;">' +
                            '<thead>' +
                            '<tr>' +
                            '<th>指标</th>' +
                            '<th>测定值</th>' +
                            '<th>单位</th>' +
                            '</tr>' +
                            '</thead>' +
                            '<tbody>' +
                            '<tr>' +
                            '<td>超敏C反应蛋白</td>' +
                            '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204001" name="204001"></td>' +
                            '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">mg/L</td>' +
                            '</tr>' +
                            '<tr>' +
                            '<td>白细胞计数（WBC）</td>' +
                            '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204002" name="204002"></td>' +
                            '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">×10^9/L</td>' +
                            '</tr>' +
                            '<tr>' +
                            '<td>白蛋白（ALB）</td>' +
                            '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204003" name="204003"></td>' +
                            '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">g/L</td>' +
                            '</tr>' +
                            '<tr>' +
                            '<td>尿素（BUN）</td>' +
                            '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204004" name="204004"></td>' +
                            '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">mmol/l</td>' +
                            '</tr>' +
                            '<tr>' +
                            '<td>肌酐（CR）</td>' +
                            '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204005" name="204005"></td>' +
                            '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">μmol/L</td>' +
                            '</tr>' +
                            '<tr>' +
                            '<td>尿酸（UA）</td>' +
                            '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204006" name="204006"></td>' +
                            '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">μmol/L</td>' +
                            '</tr>' +
                            '<tr>' +
                            '<td>甘油三酯（TG）</td>' +
                            '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204007" name="204007"></td>' +
                            '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">mmol/l</td>' +
                            '</tr>' +
                            '<tr>' +
                            '<td>总胆固醇（TC）</td>' +
                            '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204008" name="204008"></td>' +
                            '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">mmol/l</td>' +
                            '</tr>' +
                            '<tr>' +
                            '<td>高密度脂蛋白胆固醇（HDL-c）</td>' +
                            '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204009" name="204009"></td>' +
                            '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">mmol/l</td>' +
                            '</tr>' +
                            '<tr>' +
                            '<td>低密度脂蛋白胆固醇（LDL-c）</td>' +
                            '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204010" name="204010"></td>' +
                            '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">mmol/l</td>' +
                            '</tr>' +
                            '<tr>' +
                            '<td>钠（Na）</td>' +
                            '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204011" name="204011"></td>' +
                            '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">mmol/l</td>' +
                            '</tr>' +
                            '<tr>' +
                            '<td>钾（K）</td>' +
                            '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204012" name="204012"></td>' +
                            '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">mmol/l</td>' +
                            '</tr>' +
                            '<tr>' +
                            '<td>D-二聚体</td>' +
                            '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204013" name="204013"></td>' +
                            '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">ng</td>' +
                            '</tr>' +
                            '<tr>' +
                            '<td>纤维蛋白质</td>' +
                            '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204014" name="204014"></td>' +
                            '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">g/L</td>' +
                            '</tr>' +
                            '<tr>' +
                            '<td>24小时尿微量白蛋白</td>' +
                            '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204015" name="204015"></td>' +
                            '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">mg/24h</td>' +
                            '</tr>' +
                            '<tr>' +
                            '<td>尿白蛋白/肌酐</td>' +
                            '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204016" name="204016"></td>' +
                            '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">mg/mmol</td>' +
                            '</tr>' +
                            '<tr>' +
                            '<td>24小时尿量</td>' +
                            '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204017" name="204017"></td>' +
                            '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input"></td>' +
                            '</tr>' +
                            '<tr>' +
                            '<td>24小时尿蛋白定量</td>' +
                            '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204018" name="204018"></td>' +
                            '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">L</td>' +
                            '</tr>' +
                            '</tbody>' +
                            '</table>' +
                            '</div>' +
                            '</div>' +
                            '<div class="qss-form-item layui-form-item">' +
                            '<div class="layui-form-label layui-form-item" style="margin-bottom:5px;">CG eGFR：<input type="text" lay-verify="number_char" lay-verType="tips" class="input-border-bottom data-204019" name="204019">ml/min（系统自动计算），MDRD eGFR:<input type="text" lay-verify="number_char" lay-verType="tips" class="input-border-bottom data-204020" name="204020">ml/min（系统自动计算）</div>' +
                            '</div>' +
                            '<div class="qss-form-item layui-form-item">' +
                            '<div class="layui-form-label layui-form-item" style="margin-bottom:5px;">备注：CG公式：（140-年龄）*体重/（0.81*血肌酐）*（0.85女性）</div>' +
                            '</div>' +
                            '<div class="qss-form-item layui-form-item">' +
                            '<div class="layui-form-label layui-form-item" style="margin-bottom:5px;">MDRD简化公式：175*（血肌酐/88.4）^-1.234*年龄^-0.179*（0.79女性）</div>' +
                            '</div>' +
                            '</div>';
                        $('.content-204').append(str);
                        laydate.render({
                            elem: '#date204-' + randId
                        })
                        $.each(item2, function(index3, item3) {
                            if (index3 == 0) {
                                if (item3.date != '0000-00-00') {
                                    $('.item-204' + index2).find('.date-204').val(item3.date);
                                }
                            }
                            $('.item-204' + index2).find('.data-' + item3.answer_id).val(item3.answer_name);
                        })
                    })
                }
            })
            form.render();
        });
    }

    $(document).ready(function() {
        var height = $(window).height() - 2;
        //$('.container').height(height);
        var patient_id = getLocalStorage('patient_id');

        //完整度
        getCompletion();

        $('td input').focus(function() {
            $(this).parent().addClass('qss-td-bg-white')
        })
        $('td input').blur(function() {
            $(this).parent().removeClass('qss-td-bg-white');
        });
        layui.use(['element', 'form', 'layer', 'laydate', 'laypage'], function() {
            var element = layui.element;
            var form = layui.form;
            var layer = layui.layer;
            var laydate = layui.laydate;
            var laypage = layui.laypage;
            initForm(patient_id, form, laydate);

            // v1.1 信息校验
            form.verify({
                number_char: function(value) {
                    // if (value.length > 30) {
                    //     return '输入内容不能超过30个字';
                    // }
                    // if (!new RegExp("(^$)|^(?!(0[<>0-9]{0,}$))[<>0-9]{1,}[.]{0,}[0-9<>]{0,}[.]{0,}[0-9]{0,}$").test(value)) {
                    //     return '只能输入正数、<、>符号';
                    // }
                },
                number_number_positive: function(value) {
                    // if (value.length > 30) {
                    //     return '输入内容不能超过30个字';
                    // }
                    // if (!new RegExp("(^$)|^(?!(0[0-9]{0,}$))[0-9]{1,}[.]{0,}[0-9]{0,}$").test(value)) {
                    //     return '只能输入正数';
                    // }
                },
            });

            $('.qss-item').on('click', 'button[class="del"]', function() {
                var that = $(this);
                var patient_name = getLocalStorage('patient_name');
                var date = $(this).parent().find('.check-date input').val();
                var title = $(this).parent().parent().parent().parent().find('.qss-item-title p').html();
                var confirm = layer.confirm('您确认要删除患者' + patient_name + '在' + date + '的' + title + '检查吗？', {
                    btn: ['确定', '取消'] //按钮
                }, function() {
                    var par = that.parent().parent().parent();
                    that.parent().parent().remove();
                    if (par.html().indexOf('div') == -1) {
                        var qid = par.attr('data-qid');
                        if (qid == 200) {
                            var randId = Math.ceil(Math.random() * 10000);
                            var str = '<div class="qss-form-item layui-form-item table-200">' +
                                '<div class="qss-form-item layui-form-item">' +
                                '<div class="check-date">检查日期 <input type="text" class="layui-input table-input date-200"  autocomplete="off" readonly="readonly" id="date200-' + randId + '"></div>' +
                                '<button type="button" class="del">删除本次</button>' +
                                '<div class="qss-item-table">' +
                                '<table class="layui-table" lay-even lay-skin="" style="border:1px solid #cccccc;">' +
                                '<thead>' +
                                '<tr>' +
                                '<th></th>' +
                                '<th>0分钟</th>' +
                                '<th>30分钟</th>' +
                                '<th>60分钟</th>' +
                                '<th>120分钟</th>' +
                                '<th>180分钟</th>' +
                                '</tr>' +
                                '</thead>' +
                                '<tbody>' +
                                '<tr>' +
                                '<td>葡萄糖（mmol/L）</td>' +
                                '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200001" name="200001"></td>' +
                                '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200002" name="200002"></td>' +
                                '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200003" name="200003"></td>' +
                                '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200004" name="200004"></td>' +
                                '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200005" name="200005"></td>' +
                                '</tr>' +
                                '<tr>' +
                                '<td>胰岛素（&#181;IU/ml）</td>' +
                                '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200006" name="200006"></td>' +
                                '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200007" name="200007"></td>' +
                                '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200008" name="200008"></td>' +
                                '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200009" name="200009"></td>' +
                                '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200010" name="200010"></td>' +
                                '</tr>' +
                                '<tr>' +
                                '<td>C肽（&#181;g/L）</td>' +
                                '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200011" name="200011"></td>' +
                                '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200012" name="200012"></td>' +
                                '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200013" name="200013"></td>' +
                                '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200014" name="200014"></td>' +
                                '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200015" name="200015"></td>' +
                                '</tr>' +
                                '</tbody>' +
                                '</table>' +
                                '</div>' +
                                '</div>' +
                                '<div class="qss-form-item layui-form-item">' +
                                '<div class="layui-form-label layui-form-item" style="margin-bottom:5px;">糖化血红蛋白：<input type="text" lay-verify="number_char" lay-verType="tips" class="input-border-bottom data-201" name="201">%</div>' +
                                '</div>' +
                                '<div class="qss-form-item layui-form-item">' +
                                '<div class="layui-form-label layui-form-item" style="margin-bottom:5px;">糖化血清蛋白：<input type="text" lay-verify="number_char" lay-verType="tips" class="input-border-bottom data-202" name="202">%</div>' +
                                '</div>' +
                                '<div class="qss-form-item layui-form-item">' +
                                '<div class="layui-form-label layui-form-item" style="margin-bottom:5px;">' +
                                '抗体指标：GAD-ab<input type="text" lay-verify="number_char" lay-verType="tips" class="input-border-bottom data-203001" name="203001">IU/ml，' +
                                'ICA<input type="text" lay-verify="number_char" lay-verType="tips" class="input-border-bottom data-203002" name="203002">，' +
                                'IAA<input type="text" lay-verify="number_char" lay-verType="tips" class="input-border-bottom data-203003" name="203003">' +
                                '</div>' +
                                '</div>' +
                                '</div>';
                            par.append(str);
                            laydate.render({
                                elem: '#date200-' + randId
                            })
                        }
                        if (qid == 204) {
                            var randId = Math.ceil(Math.random() * 10000);
                            var str = '<div class="qss-form-item layui-form-item table-204">' +
                                '<div class="qss-form-item layui-form-item">' +
                                '<div class="check-date">检查日期 <input type="text" class="layui-input table-input date-204"  autocomplete="off" readonly="readonly" id="date204-' + randId + '"></div>' +
                                '<button type="button" class="del">删除本次</button>' +
                                '<div class="qss-item-table">' +
                                '<table class="layui-table" lay-even lay-skin="" style="border:1px solid #cccccc;">' +
                                '<thead>' +
                                '<tr>' +
                                '<th>指标</th>' +
                                '<th>测定值</th>' +
                                '<th>单位</th>' +
                                '</tr>' +
                                '</thead>' +
                                '<tbody>' +
                                '<tr>' +
                                '<td>超敏C反应蛋白</td>' +
                                '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204001" name="204001"></td>' +
                                '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">mg/L</td>' +
                                '</tr>' +
                                '<tr>' +
                                '<td>白细胞计数（WBC）</td>' +
                                '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204002" name="204002"></td>' +
                                '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">×10^9/L</td>' +
                                '</tr>' +
                                '<tr>' +
                                '<td>白蛋白（ALB）</td>' +
                                '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204003" name="204003"></td>' +
                                '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">g/L</td>' +
                                '</tr>' +
                                '<tr>' +
                                '<td>尿素（BUN）</td>' +
                                '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204004" name="204004"></td>' +
                                '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">mmol/l</td>' +
                                '</tr>' +
                                '<tr>' +
                                '<td>肌酐（CR）</td>' +
                                '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204005" name="204005"></td>' +
                                '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">μmol/L</td>' +
                                '</tr>' +
                                '<tr>' +
                                '<td>尿酸（UA）</td>' +
                                '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204006" name="204006"></td>' +
                                '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">μmol/L</td>' +
                                '</tr>' +
                                '<tr>' +
                                '<td>甘油三酯（TG）</td>' +
                                '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204007" name="204007"></td>' +
                                '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">mmol/l</td>' +
                                '</tr>' +
                                '<tr>' +
                                '<td>总胆固醇（TC）</td>' +
                                '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204008" name="204008"></td>' +
                                '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">mmol/l</td>' +
                                '</tr>' +
                                '<tr>' +
                                '<td>高密度脂蛋白胆固醇（HDL-c）</td>' +
                                '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204009" name="204009"></td>' +
                                '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">mmol/l</td>' +
                                '</tr>' +
                                '<tr>' +
                                '<td>低密度脂蛋白胆固醇（LDL-c）</td>' +
                                '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204010" name="204010"></td>' +
                                '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">mmol/l</td>' +
                                '</tr>' +
                                '<tr>' +
                                '<td>钠（Na）</td>' +
                                '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204011" name="204011"></td>' +
                                '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input"></td>' +
                                '</tr>' +
                                '<tr>' +
                                '<td>钾（K）</td>' +
                                '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204012" name="204012"></td>' +
                                '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">mmol/l</td>' +
                                '</tr>' +
                                '<tr>' +
                                '<td>D-二聚体</td>' +
                                '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204013" name="204013"></td>' +
                                '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">ng</td>' +
                                '</tr>' +
                                '<tr>' +
                                '<td>纤维蛋白质</td>' +
                                '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204014" name="204014"></td>' +
                                '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">g/L</td>' +
                                '</tr>' +
                                '<tr>' +
                                '<td>24小时尿微量白蛋白</td>' +
                                '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204015" name="204015"></td>' +
                                '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">mg/24h</td>' +
                                '</tr>' +
                                '<tr>' +
                                '<td>尿白蛋白/肌酐</td>' +
                                '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204016" name="204016"></td>' +
                                '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">mg/mmol</td>' +
                                '</tr>' +
                                '<tr>' +
                                '<td>24小时尿量</td>' +
                                '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204017" name="204017"></td>' +
                                '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">L</td>' +
                                '</tr>' +
                                '<tr>' +
                                '<td>24小时尿蛋白定量</td>' +
                                '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204018" name="204018"></td>' +
                                '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">mg/24h</td>' +
                                '</tr>' +
                                '</tbody>' +
                                '</table>' +
                                '</div>' +
                                '</div>' +
                                '<div class="qss-form-item layui-form-item">' +
                                '<div class="layui-form-label layui-form-item" style="margin-bottom:5px;">CG eGFR：<input type="text" lay-verify="number_char" lay-verType="tips" class="input-border-bottom data-204019" name="204019">ml/min（系统自动计算），MDRD eGFR:<input type="text" lay-verify="number_char" lay-verType="tips" class="input-border-bottom data-204020" name="204020">ml/min（系统自动计算）</div>' +
                                '</div>' +
                                '<div class="qss-form-item layui-form-item">' +
                                '<div class="layui-form-label layui-form-item" style="margin-bottom:5px;">备注：CG公式：（140-年龄）*体重/（0.81*血肌酐）*（0.85女性）</div>' +
                                '</div>' +
                                '<div class="qss-form-item layui-form-item">' +
                                '<div class="layui-form-label layui-form-item" style="margin-bottom:5px;">MDRD简化公式：175*（血肌酐/88.4）^-1.234*年龄^-0.179*（0.79女性）</div>' +
                                '</div>' +
                                '</div>';
                            par.append(str);
                            laydate.render({
                                elem: '#date204-' + randId
                            })
                        }
                    }
                    layer.close(confirm)
                }, function() {
                    layer.close(confirm)
                });
            })
            laydate.render({
                elem: '#date200'
            })
            laydate.render({
                elem: '#date204'
            })
            form.on('submit(submit-btn)', function(data) {
                var jumpType = $(this).attr('data-type');
                var question = {
                    200: [],
                    204: [],
                }
                var isSubmit = 1;
                $('.table-200').each(function(index, item) {
                    var qid = 200;
                    question[qid][index] = [];
                    var data = {};
                    var date = '';
                    var isDate = false;
                    data['200001'] = $(this).find('.data-200001').val();
                    data['200002'] = $(this).find('.data-200002').val();
                    data['200003'] = $(this).find('.data-200003').val();
                    data['200004'] = $(this).find('.data-200004').val();
                    data['200005'] = $(this).find('.data-200005').val();
                    data['200006'] = $(this).find('.data-200006').val();
                    data['200007'] = $(this).find('.data-200007').val();
                    data['200008'] = $(this).find('.data-200008').val();
                    data['200009'] = $(this).find('.data-200009').val();
                    data['200010'] = $(this).find('.data-200010').val();
                    data['200011'] = $(this).find('.data-200011').val();
                    data['200012'] = $(this).find('.data-200012').val();
                    data['200013'] = $(this).find('.data-200013').val();
                    data['200014'] = $(this).find('.data-200014').val();
                    data['200015'] = $(this).find('.data-200015').val();
                    data['201'] = $(this).find('.data-201').val();
                    data['202'] = $(this).find('.data-202').val();
                    data['203001'] = $(this).find('.data-203001').val();
                    data['203002'] = $(this).find('.data-203002').val();
                    data['203003'] = $(this).find('.data-203003').val();
                    date = $(this).find('.date-200').val();
                    $.each(data, function(index1, item1) {
                        if (item1 != '') {
                            isDate = true;
                            return false;
                        }
                    });
                    if (isDate == true) {
                        if (date == '') {
                            isSubmit = 0;
                            $(this).find('.date-200').css('border-color', 'red');
                            layer.msg('请输入日期', {
                                icon: 5,
                                time: 1000
                            });
                            return false;
                        } else {
                            question[qid][index].push(data);
                            question[qid][index].push(date);
                        }
                    }
                })
                if (isSubmit == 0) {
                    return false;
                }
                $('.table-204').each(function(index, item) {
                    var qid = 204;
                    question[qid][index] = [];
                    var data = {};
                    var date = '';
                    var isDate = false;
                    data['204001'] = $(this).find('.data-204001').val();
                    data['204002'] = $(this).find('.data-204002').val();
                    data['204003'] = $(this).find('.data-204003').val();
                    data['204004'] = $(this).find('.data-204004').val();
                    data['204005'] = $(this).find('.data-204005').val();
                    data['204006'] = $(this).find('.data-204006').val();
                    data['204007'] = $(this).find('.data-204007').val();
                    data['204008'] = $(this).find('.data-204008').val();
                    data['204009'] = $(this).find('.data-204009').val();
                    data['204010'] = $(this).find('.data-204010').val();
                    data['204011'] = $(this).find('.data-204011').val();
                    data['204012'] = $(this).find('.data-204012').val();
                    data['204013'] = $(this).find('.data-204013').val();
                    data['204014'] = $(this).find('.data-204014').val();
                    data['204015'] = $(this).find('.data-204015').val();
                    data['204016'] = $(this).find('.data-204016').val();
                    data['204017'] = $(this).find('.data-204017').val();
                    data['204018'] = $(this).find('.data-204018').val();
                    data['204019'] = $(this).find('.data-204019').val();
                    data['204020'] = $(this).find('.data-204020').val();
                    date = $(this).find('.date-204').val();
                    $.each(data, function(index1, item1) {
                        if (item1 != '') {
                            isDate = true;
                            return false;
                        }
                    });
                    if (isDate == true) {
                        if (date == '') {
                            isSubmit = 0;
                            $(this).find('.date-204').css('border-color', 'red');
                            layer.msg('请输入日期', {
                                icon: 5,
                                time: 1000
                            });
                            return false;
                        } else {
                            question[qid][index].push(data);
                            question[qid][index].push(date);
                        }
                    }
                })
                if (isSubmit == 0) {
                    return false;
                }
                var chapterId = 2001;
                var visitLevel = 1;
                var params = {
                    'hosp_id': getLocalStorage('hosp_id'),
                    'dept_id': getLocalStorage('dept_id'),
                    'user_id': getLocalStorage('patient_id'),
                    'doc_id': getLocalStorage('doc_id'),
                    'visit_level': 1,
                    'template_id': 20,
                    'terminal_flg': 0,
                    'data': [{
                        'visit_level': 1,
                        'user_id': getLocalStorage('patient_id'),
                        'doc_id': getLocalStorage('doc_id'),
                        "terminal_flg": "0",
                        'template_id': 20,
                        "datasource": "2",
                        'answer': []
                    }]
                };
                var answer = [];
                $.each(question, function(question_id, item) {
                    $.each(item, function(index, data) {
                        if (data.length > 0) {
                            var arr = [];
                            $.each(data[0], function(i, value) {
                                var qid = question_id;
                                arr.push({
                                    'chapter_id': chapterId,
                                    'question_id': qid,
                                    'subquestion_id': i,
                                    'answer_id': i,
                                    'answer_name': value,
                                    'visit_level': 1,
                                    'date': data[1]
                                })
                            })
                            answer.push(arr);
                        }
                    })
                })
                params.data[0].answer = answer;
                var token = getLocalStorage('token');
                var headers = {};
                if (token) {
                    headers.Authorization = 'Bearer ' + token;
                }

                let formData = new FormData;

                //formData.append('fileData',$("#fileUpload").prop('files')[0]);
                formData.append('hosp_id', getLocalStorage('hosp_id'));
                formData.append('dept_id', getLocalStorage('dept_id'));
                formData.append('user_id', getLocalStorage('patient_id'));
                formData.append('doc_id', getLocalStorage('doc_id'));
                formData.append('visit_level', 1);
                formData.append('template_id', 20);
                formData.append('terminal_flg', 0);
                formData.append('data', JSON.stringify(params.data));
                var token = getLocalStorage('token');
                var headers = {};
                if (token) {
                    headers.Authorization = 'Bearer ' + token;
                }
                $.ajax({
                    url: configUrl.host + '/api/v1/pituitary/qss/info',
                    type: 'POST',
                    data: formData,
                    processData: false,
                    cache: false,
                    contentType: false,
                    headers: headers,
                    success: function(res) {
                        console.log(res);
                        if (res.status == 0) {
                            layer.msg('操作成功', {
                                icon: 6,
                                time: 1000
                            }, function() {
                                if (jumpType == 0) {
                                    //不跳转
                                    window.location.reload();
                                } else {
                                    //跳转
                                    window.location.href = '../list.html';
                                }
                            });
                        } else {
                            layer.msg(res.msg);
                        }
                    },
                    error: function() {
                        alert('数据提交失败');
                    }
                })

                return false;
            });

            $('.add-new-200').on('click', function() {
                var randId = Math.ceil(Math.random() * 10000);
                var str = '<div class="qss-form-item layui-form-item table-200">' +
                    '<div class="qss-form-item layui-form-item">' +
                    '<div class="check-date">检查日期 <input type="text" class="layui-input table-input date-200"  autocomplete="off" readonly="readonly" id="date200-' + randId + '"></div>' +
                    '<button type="button" class="del">删除本次</button>' +
                    '<div class="qss-item-table">' +
                    '<table class="layui-table" lay-even lay-skin="" style="border:1px solid #cccccc;">' +
                    '<thead>' +
                    '<tr>' +
                    '<th></th>' +
                    '<th>0分钟</th>' +
                    '<th>30分钟</th>' +
                    '<th>60分钟</th>' +
                    '<th>120分钟</th>' +
                    '<th>180分钟</th>' +
                    '</tr>' +
                    '</thead>' +
                    '<tbody>' +
                    '<tr>' +
                    '<td>葡萄糖（mmol/L）</td>' +
                    '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200001" name="200001"></td>' +
                    '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200002" name="200002"></td>' +
                    '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200003" name="200003"></td>' +
                    '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200004" name="200004"></td>' +
                    '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200005" name="200005"></td>' +
                    '</tr>' +
                    '<tr>' +
                    '<td>胰岛素（&#181;IU/ml）</td>' +
                    '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200006" name="200006"></td>' +
                    '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200007" name="200007"></td>' +
                    '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200008" name="200008"></td>' +
                    '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200009" name="200009"></td>' +
                    '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200010" name="200010"></td>' +
                    '</tr>' +
                    '<tr>' +
                    '<td>C肽（&#181;g/L）</td>' +
                    '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200011" name="200011"></td>' +
                    '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200012" name="200012"></td>' +
                    '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200013" name="200013"></td>' +
                    '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200014" name="200014"></td>' +
                    '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-200015" name="200015"></td>' +
                    '</tr>' +
                    '</tbody>' +
                    '</table>' +
                    '</div>' +
                    '</div>' +
                    '<div class="qss-form-item layui-form-item">' +
                    '<div class="layui-form-label layui-form-item" style="margin-bottom:5px;">糖化血红蛋白：<input type="text" lay-verify="number_char" lay-verType="tips" class="input-border-bottom data-201" name="201">%</div>' +
                    '</div>' +
                    '<div class="qss-form-item layui-form-item">' +
                    '<div class="layui-form-label layui-form-item" style="margin-bottom:5px;">糖化血清蛋白：<input type="text" lay-verify="number_char" lay-verType="tips" class="input-border-bottom data-202" name="202">%</div>' +
                    '</div>' +
                    '<div class="qss-form-item layui-form-item">' +
                    '<div class="layui-form-label layui-form-item" style="margin-bottom:5px;">' +
                    '抗体指标：GAD-ab<input type="text" lay-verify="number_char" lay-verType="tips" class="input-border-bottom data-203001" name="203001">IU/ml，' +
                    'ICA<input type="text" lay-verify="number_char" lay-verType="tips" class="input-border-bottom data-203002" name="203002">，' +
                    'IAA<input type="text" lay-verify="number_char" lay-verType="tips" class="input-border-bottom data-203003" name="203003">' +
                    '</div>' +
                    '</div>' +
                    '</div>';
                $('.content-200').append(str);
                laydate.render({
                    elem: '#date200-' + randId
                })
            })
            $('.add-new-204').on('click', function() {
                var randId = Math.ceil(Math.random() * 10000);
                var str = '<div class="qss-form-item layui-form-item table-204">' +
                    '<div class="qss-form-item layui-form-item">' +
                    '<div class="check-date">检查日期 <input type="text" class="layui-input table-input date-204"  autocomplete="off" readonly="readonly" id="date204-' + randId + '"></div>' +
                    '<button type="button" class="del">删除本次</button>' +
                    '<div class="qss-item-table">' +
                    '<table class="layui-table" lay-even lay-skin="" style="border:1px solid #cccccc;">' +
                    '<thead>' +
                    '<tr>' +
                    '<th>指标</th>' +
                    '<th>测定值</th>' +
                    '<th>单位</th>' +
                    '</tr>' +
                    '</thead>' +
                    '<tbody>' +
                    '<tr>' +
                    '<td>超敏C反应蛋白</td>' +
                    '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204001" name="204001"></td>' +
                    '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">mg/L</td>' +
                    '</tr>' +
                    '<tr>' +
                    '<td>白细胞计数（WBC）</td>' +
                    '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204002" name="204002"></td>' +
                    '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">×10^9/L</td>' +
                    '</tr>' +
                    '<tr>' +
                    '<td>白蛋白（ALB）</td>' +
                    '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204003" name="204003"></td>' +
                    '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">g/L</td>' +
                    '</tr>' +
                    '<tr>' +
                    '<td>尿素（BUN）</td>' +
                    '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204004" name="204004"></td>' +
                    '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">mmol/L</td>' +
                    '</tr>' +
                    '<tr>' +
                    '<td>肌酐（CR）</td>' +
                    '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204005" name="204005"></td>' +
                    '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">μmol/L</td>' +
                    '</tr>' +
                    '<tr>' +
                    '<td>尿酸（UA）</td>' +
                    '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204006" name="204006"></td>' +
                    '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">μmol/L</td>' +
                    '</tr>' +
                    '<tr>' +
                    '<td>甘油三酯（TG）</td>' +
                    '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204007" name="204007"></td>' +
                    '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">mmol/l</td>' +
                    '</tr>' +
                    '<tr>' +
                    '<td>总胆固醇（TC）</td>' +
                    '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204008" name="204008"></td>' +
                    '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">mmol/l</td>' +
                    '</tr>' +
                    '<tr>' +
                    '<td>高密度脂蛋白胆固醇（HDL-c）</td>' +
                    '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204009" name="204009"></td>' +
                    '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">mmol/l</td>' +
                    '</tr>' +
                    '<tr>' +
                    '<td>低密度脂蛋白胆固醇（LDL-c）</td>' +
                    '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204010" name="204010"></td>' +
                    '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">mmol/l</td>' +
                    '</tr>' +
                    '<tr>' +
                    '<td>钠（Na）</td>' +
                    '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204011" name="204011"></td>' +
                    '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">mmol/l</td>' +
                    '</tr>' +
                    '<tr>' +
                    '<td>钾（K）</td>' +
                    '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204012" name="204012"></td>' +
                    '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">mmol/l</td>' +
                    '</tr>' +
                    '<tr>' +
                    '<td>D-二聚体</td>' +
                    '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204013" name="204013"></td>' +
                    '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">ng</td>' +
                    '</tr>' +
                    '<tr>' +
                    '<td>纤维蛋白质</td>' +
                    '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204014" name="204014"></td>' +
                    '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">g/L</td>' +
                    '</tr>' +
                    '<tr>' +
                    '<td>24小时尿微量白蛋白</td>' +
                    '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204015" name="204015"></td>' +
                    '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">mg/24h</td>' +
                    '</tr>' +
                    '<tr>' +
                    '<td>尿白蛋白/肌酐</td>' +
                    '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204016" name="204016"></td>' +
                    '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">mg/mmol</td>' +
                    '</tr>' +
                    '<tr>' +
                    '<td>24小时尿量</td>' +
                    '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204017" name="204017"></td>' +
                    '<td><input type="text" class="layui-input table-input">L</td>' +
                    '</tr>' +
                    '<tr>' +
                    '<td>24小时尿蛋白定量</td>' +
                    '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input data-204018" name="204018"></td>' +
                    '<td><input type="text" lay-verify="number_char" lay-verType="tips" class="layui-input table-input">mg/24h</td>' +
                    '</tr>' +
                    '</tbody>' +
                    '</table>' +
                    '</div>' +
                    '</div>' +
                    '<div class="qss-form-item layui-form-item">' +
                    '<div class="layui-form-label layui-form-item" style="margin-bottom:5px;">CG eGFR：<input type="text" lay-verify="number_char" lay-verType="tips" class="input-border-bottom data-204019" name="204019">ml/min（系统自动计算），MDRD eGFR:<input type="text" lay-verify="number_char" lay-verType="tips" class="input-border-bottom data-204020" name="204020">ml/min（系统自动计算）</div>' +
                    '</div>' +
                    '<div class="qss-form-item layui-form-item">' +
                    '<div class="layui-form-label layui-form-item" style="margin-bottom:5px;">备注：CG公式：（140-年龄）*体重/（0.81*血肌酐）*（0.85女性）</div>' +
                    '</div>' +
                    '<div class="qss-form-item layui-form-item">' +
                    '<div class="layui-form-label layui-form-item" style="margin-bottom:5px;">MDRD简化公式：175*（血肌酐/88.4）^-1.234*年龄^-0.179*（0.79女性）</div>' +
                    '</div>' +
                    '</div>';
                $('.content-204').append(str);
                laydate.render({
                    elem: '#date204-' + randId,
                })
            })
        })
    })
</script>

</html>